import { createStore } from 'vuex';

export const store = createStore({
	state:{
		loading: false,
		isLogin: false,
		token: '',
		userId: '',
		inviteUserId: '',
		isPoint: true,
		userInfo: {
			nickName: '',
			headUrl: '',
			phone: '',
			addr: '',
			position: '',
		},
	},
	mutations: {
		changeState(state, obj) {
			// 变更状态
			Object.keys(obj).forEach((key) => {
				if (state.hasOwnProperty(key)) {
					// @ts-ignore
					state[key] = obj[key]
				}
			})
		}
	}
})